package com.eddie.auction.utils;

import com.alibaba.fastjson2.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Eddie
 * @date 2022/08/01 16:50
 **/
public class PrintUtils {

    private PrintUtils() {}

    public static void write(Object obj, HttpServletResponse response) throws IOException {
        response.setContentType("text/html; charset=utf-8");
        PrintWriter out = response.getWriter();
        String json = JSON.toJSONString(obj);
        out.print(json);
        out.flush();
        out.close();
    }
}
